Repository navigation
Conversation
- Add CONFIG_PLATFORM_RP2350 platform support - Add board overlay and conf for rpi_pico2/rp2350a/m33 - Add static audio pipelines for EQ, volume, and UAC2 bridging - Enable ARM Cortex-M SIMD DSP optimizations Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…peline - sof_static_pipeline: maintain continuous isochronous IN packet streaming by sending zero-filled frames when real audio is idle, eliminating host ALSA -EIO read timeouts. Re-trigger send_capture_pending in buf_release to keep endpoint FIFO replenished. - static_pipeline_loader: restore synchronous pipeline_trigger_run() on start and stop triggers. - rp2350_pipeline_def: switch pipeline audio formats and intermediate buffers to float, set time domain to DMA, and configure sink/source IDs. - usb_audio: support float sample format conversions in static pipeline and disable synthetic tone generator by default. - rpi_pico2: enable CONFIG_UDC_ENABLE_SOF=y for SOF-driven audio scheduling. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lgirdwood
left a comment
There was a problem hiding this comment.
This has lots of zephyr code which can be carried in my zephyr fork atm and referenced via a temp west commit. It also contain debug code which should be removed and the test code should be a ztest.
| struct pipeline *pipe = pipeline_new(NULL, pdesc->pipeline_id, pdesc->priority, | ||
| pdesc->pipeline_id, NULL); | ||
| if (!pipe) { | ||
| g_topo_fail_item = pdesc->pipeline_id; |
| /* Propagate params and prepare throughout the pipeline walk */ | ||
| int ret_prms = pipeline_params(pipe, host_or_sched, &prms); | ||
| if (ret_prms < 0) { | ||
| if (!g_topo_fail_item) |
| struct usb_audio_ring_buffer *ring = &uad->ring; | ||
| k_spinlock_key_t key = k_spin_lock(&ring->lock); | ||
|
|
||
| if (s_tone_enabled) { |
There was a problem hiding this comment.
test code should be in the ztests
|
|
||
| #define USB_AUDIO_RING_BUFFER_SIZE 16384 | ||
| #define USB_AUDIO_PREBUFFER_BYTES 3840 /* 20ms at 48kHz stereo 16-bit */ | ||
| #define USB_AUDIO_PREBUFFER_BYTES 384 /* 2ms at 48kHz stereo 16-bit */ |
There was a problem hiding this comment.
this is probably platform dependent, should come from DT
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
9 open issues
For most Zephyr targets, the kernel callsmain()with no arguments (typicallyvoid main(void)/… · New The vendor request allows the host to read arbitrary memory addresses, which is a serious… · New Previously, a failed PRE_START trigger aborted the start. Now the function logs the error but… · New This UUID does not match theusb_audioUUID added touuid-registry.txt(9a84b5e2-...). Since… · New These new globals are introduced unconditionally and exported with generic names, increasing global… · New Directly forcingc->stateandpipe->statusbypasses the normal component/pipeline state machine… · New Byte-by-byte ring-buffer copies with modulo in the loop add significant overhead on MCUs,… · New Determining playback vs capture usingpipeline_id/idis fragile and can mis-route global… · New This change gates the syscall declaration onCONFIG_USERSPACEbut does not add a… · New
What changed in this PR
Adds initial SOF + Zephyr platform support for Raspberry Pi RP2350 (Pico 2) and introduces a UAC2-based static audio pipeline with USB streaming.
Changes:
- Introduces a new
rp2350platform (init/clock/mailbox stubs) and Zephyr build glue. - Adds a USB audio component plus RP2350 static topology and UAC2 control/callback plumbing.
- Adds non-userspace (
!CONFIG_USERSPACE) compatibility guards for various Zephyr syscall-based APIs.
| File | Description |
|---|---|
zephyr/CMakeLists.txt |
Adds RP2350 platform selection and build dependencies/includes. |
src/platform/rp2350/* |
New RP2350 platform implementation, headers, clock init, and static topology definition. |
src/audio/usb_audio.c / src/include/sof/audio/usb_audio.h |
New USB audio component with a ring buffer bridging UAC2 and SOF pipelines. |
src/audio/pipeline/static_pipeline_loader.c |
Adds failure-stage diagnostics and changes pipeline start/stop/reset behavior. |
src/audio/pipeline/sof_static_pipeline.c / src/include/sof/audio/pipeline/sof_static_pipeline.h |
Adds UAC2 ops + static pipeline runtime integration (esp/teensy/rp2350). |
app/src/main.c / app/src/usbd_init.c |
Initializes static pipelines + UAC2 ops, and adds vendor diagnostic requests. |
Various src/include/* and zephyr/include/* |
Adds CONFIG_USERSPACE guards and fallback stubs for some syscall APIs. |
Review effort: Lite
| int main(int argc, char *argv[]) | ||
| { | ||
| ARG_UNUSED(argc); | ||
| ARG_UNUSED(argv); |
| static struct net_buf *rp2350_peek_to_host(const struct usbd_context *const ctx, | ||
| const struct usb_setup_packet *const setup) | ||
| { | ||
| uint32_t addr = (setup->wIndex << 16) | setup->wValue; | ||
| uint16_t len = MIN(setup->wLength, 64); | ||
| if (!len) return NULL; | ||
| struct net_buf *buf = usbd_ep_ctrl_data_in_alloc(ctx, len); | ||
| if (!buf) return NULL; | ||
| net_buf_add_mem(buf, (const void *)addr, len); | ||
| return buf; | ||
| } |
| @@ -1916,7 +1958,20 @@ int sof_static_pipeline_start(uint32_t pipeline_id) | |||
| int ret = pipeline_trigger_run(pipe, dev, COMP_TRIGGER_PRE_START); | |||
| if (ret < 0) { | |||
| LOG_ERR("Pipeline %u pre-start trigger failed: %d", pipeline_id, ret); | |||
| /* UUID for USB Audio Component */ | ||
| /* b95039f6-3d23-41a4-9276-2fbb27c62d01 */ | ||
| #define SOF_USB_AUDIO_UUID \ | ||
| DECLARE_SOF_RT_UUID("usb_audio", 0xb95039f6, 0x3d23, 0x41a4, \ | ||
| 0x92, 0x76, 0x2f, 0xbb, 0x27, 0xc6, 0x2d, 0x01) |
| int g_topo_fail_stage = 0; | ||
| int g_topo_fail_item = 0; | ||
| int g_topo_fail_code = 0; |
| if (pipe->status != COMP_STATE_READY) { | ||
| if (s_active_topo) { | ||
| for (size_t j = 0; j < s_active_topo->num_comps; j++) { | ||
| if (s_active_topo->comps[j].pipeline_id == pipeline_id) { | ||
| struct comp_dev *c = sof_static_comp_get(s_active_topo->comps[j].id); | ||
| if (c) { | ||
| comp_reset(c); | ||
| c->state = COMP_STATE_READY; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| pipeline_reset(pipe, dev); | ||
| pipe->status = COMP_STATE_READY; | ||
| } |
| for (size_t i = 0; i < bytes; i++) { | ||
| ring->buf[ring->head] = s[i]; | ||
| ring->head = (ring->head + 1) % USB_AUDIO_RING_BUFFER_SIZE; | ||
| } |
| if (config->pipeline_id == 1 || config->id == 1) { | ||
| g_playback_data = uad; | ||
| } else { | ||
| g_capture_data = uad; | ||
| } |
| #if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION) && defined(CONFIG_USERSPACE) | ||
| __syscall int lib_manager_free_module(const uint32_t component_id); | ||
|
|
||
| #include <zephyr/syscalls/lib_manager.h> |


Summary
This draft PR introduces platform support for the Raspberry Pi RP2350 (Pico 2 / ARM Cortex-M33 @ 150 MHz with single-precision hardware FPU) running Sound Open Firmware (SOF) with Zephyr RTOS and USB Audio Class 2.0 (UAC2).
All changes are rebased cleanly on upstream
thesofproject/sof:mainand validated on physical RP2350 hardware bridges (Board A Master Tx and Board B Slave Rx) with hardware loopback audio streaming achieving 84.67 dB SNR at 1000.1 Hz across both boards.Key Changes
1. RP2350 Platform Support (
src/platform/rp2350/&app/boards/rpi_pico2/)rpi_pico2_rp2350a_m33) and Zephyr 4.5+ qualifiers (rpi_pico2_rp2350a_m33_0).CONFIG_PICOLIBC=y) to enforce aligned 32-bit memory access for RP2350 USB DPRAM buffers.2. Audio Processing & Static Pipelines (
src/audio/&src/platform/rp2350/rp2350_pipeline_def.c)-EIOread timeouts.buf_release) to prevent capture underflow.COMP_STATE_READY.3. Zephyr Application & Compatibility (
app/&zephyr/)src/include/*andzephyr/include/sof/lib/cpu.hallowing full Zephyr application builds on platforms withoutCONFIG_USERSPACE.size_t nbyte, unsigned int nch).Hardware Verification & Test Results
Tested on dual Raspberry Pi Pico 2 development boards connected to host (
moth):SOF RP2350 Audio A(Card 11)SOF RP2350 Audio B(Card 15)